-- towerx - "Tower of Akanthos"

function autoexec()
 if (get_progress(P_UNIFORM) == 0) then
 wait_for_entity(HERO1, HERO1)
  clear_buffer()
  screen_dump()
  do_fadein(25)
  set_autoparty(1)
  --set_vfollow(1)
  set_ent_speed(HERO1, 4)
  wait(100)  
  set_progress(P_QUEST1,11);
  wait_for_entity(HERO1, HERO1)
  thought(HERO1, "I think I will need a disguise to get past all these soldiers. I better check downstairs.");
  set_autoparty(0)
  change_map("tunnel2","tower_basement");
end
  return
end

function refresh()
  return
end

function postexec()
  return
end

function zone_handler(zn)
  if (zn == 1) then
    change_map("land","tower_exit");    
  
  elseif (zn == 2) then
    change_map("tunnel2","tower_basement");

  elseif (zn == 3) then
    warp("2_dn",8)

  elseif (zn == 4) then
    bubble(HERO1,"Just a bunch of useless junk.");
  
  elseif (zn == 5) then
    warp("2_up",8)

  elseif (zn == 6) then
    warp("3_dn",8)

  elseif (zn == 7) then
    book_talk(get_pidx(0));

  elseif (zn == 8) then
    warp("3_up",8)

 elseif (zn == 9) then
    warp("4_dn",8)

  elseif (zn == 22) then
    thought(HERO1, "I better not push my luck. They look official.");

  elseif (zn == 23) then
    warp("1_up",8)

  elseif (zn == 24) then
    thought(HERO1, "Locked.");

  elseif (zn == 25) then
    chest(18, I_ROBE2, 1)
    if (get_treasure(18) == 1) then
      bubble(HERO1,"Theres nothing left."); 
    end 

       end
      end
      
 function entity_handler(en)
  if (en == 0) then 
    bubble(en,"Nice uniform.");
    bubble(HERO1,"Thanks.");

  elseif (en == 1) then
    bubble(en,"Its a good thing those wretches over there in Diduma have been quiet."); 

  elseif (en == 2) then
    if (prompt(en,2,0,"Why don't you join us for an ale?","  yes","  no","") == 0) then 
      move_entity(HERO1, "sit") 
      wait_for_entity(HERO1, HERO1)
      set_ent_facing(HERO1, FACE_DN)
      set_ent_facing(2, FACE_UP)
      wait_for_entity(HERO1, 2)
      wait(75)
      bubble(0,"So where are you from anyways?");
      bubble(HERO1,"Oh just a small village South East of the Citadel.");
      bubble(en,"Did you here?");
      bubble(HERO1,"I must go now.");

    else
      bubble(HERO1,"No thanks, I must be going."); 
      bubble(en,"Well come back sometime.");
    end

  elseif (en == 3) then
    bubble(en,"What are you supposed to be doing, soldier?");
    bubble(HERO1,"I'm on leave right now but I will be journeying soon.");
   
  elseif (en == 6) then
    bubble(en,"Greetings.");

  elseif (en == 7) then
    bubble(en,"We are discussing important buisness.");

  elseif (en == 8) then
    bubble(en,"As I was saying before I got interrupted...");   
    set_ent_facing(8, FACE_UP)
    wait_for_entity(8, 8)
    --bubble(en,".");   

  end
     end
